package com.guch.help.activity;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.guch.help.R;
import com.guch.help.adapter.HistoryRecordAdapter;
import com.guch.help.bean.HistoryRecordBean;
import com.guch.help.databinding.ActivityHistoryCleanRecordBinding;

import java.util.ArrayList;
import java.util.List;

/**
 * 清理记录
 */
public class HistoryClearingRecordActivity extends AppCompatActivity {

    private ActivityHistoryCleanRecordBinding mBinding;
    private List<HistoryRecordBean> mList;
    private HistoryRecordAdapter mAdapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_history_clean_record);
        mBinding.rlTitle.ivBack.setOnClickListener(v -> finish());

        mBinding.rlTitle.tvTitle.setText(getResources().getString(R.string.clean_history));

        getData();

        mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
        DividerItemDecoration itemDecoration = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
        itemDecoration.setDrawable(ContextCompat.getDrawable(this, R.drawable.divider_inset));
        mBinding.recyclerView.addItemDecoration(itemDecoration);

        mAdapter = new HistoryRecordAdapter(this, mList);
        mBinding.recyclerView.setAdapter(mAdapter);
    }

    private void getData() {
        mList = new ArrayList<>();
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", "主动停止"));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "中止", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "中止", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "中止", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "中止", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "中止", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "中止", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "中止", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "中止", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "中止", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "中止", ""));
        mList.add(new HistoryRecordBean("2024-10-16 08:34:20", "成功", ""));
    }

}
